home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-15 | 19.7 KB | 571 lines | [TEXT/MPS ] |
- //
- // fontCompress.r
- //
- // This example demonstrates use of InstaCompOne for Font compression
- // with the Apple Installer 4.x. Fonts are installed through compression,
- // and through font splitting and compression. For reference, an example
- // of installing a font without compression or splitting is included.
- //
- // How To Build the Script:
- //
- // To build installer script access "Build…" item within "Build" menu
- // and enter the scriptName "fontCompress". To build the installer
- // debugger version of the installer script enter the scriptname
- // with the addition ".debug" ( "fontCompress.debug" ).
- //
- // There must be a copy of the file "InstaCompOneSCExt.rsrc"
- // that has been renamed to "fontCompress.scx" included in this
- // folder as well. This file will automatically be copied and
- // renamed ( from the InstaCompOne folder in the SDK ) when the
- // makefile for this example is run.
- //
- // What this example does :
- //
- // This example demonstrates use of InstaCompOne archives,
- // the FileAndRsrcSplitterTool, and the InstaCompOneTool compression
- // utility to install fonts. This example uses the Installer 3.x style of
- // creating Custom Install options for sake of simplicity and is not
- // intended as an example of how to create Installer 4.0 Easy or
- // Custom Install options.
- //
- // This example shows how to compress a font, and how to split and
- // compress a font; but is does not demonstrate splitting a font
- // without compression.
- //
- //
- // ================= fonts and the Apple 4.0 Installer ====================
- //
- // The Apple Installer 4.0 handles font installation automatically
- // for different versions of the Macintosh operating system.
- // Pre-7.0, 7.0, and post-7.0 systems are all supported with
- // identical installer source script code.
- //
- // To utilize this automated installation of fonts, simply specify
- // the "special-fonts:" file path in the target spec ( 'intf' )
- // for the font to be installed.
- //
- // ================== preparing split or compressed files =================
- //
- //
- // case #1 : Font compressed directly into a single archive :
- //
- // 1) Compress each font resource item ( except 'FOND')
- // within the source font file into a 'part'
- // resource with a unique rsrc ID within an archive. This
- // must be done for each ID of each resource type
- // except 'FOND'.
- // Example:
- // InstaCompOneTool {FontFileName} -k sfnt=9217 -a part=128 -o {FontArchiveName}
- //
- // NOTE: It's best to specify 'part' and a unique rsrc ID for each
- // compressed resource archive created within the source file.
- // ( This does not include resources of type 'FOND')
- //
- // 2) Copy ( without compression ) the 'FOND' resource
- // from the source font file into a 'iFND' resource within
- // the same archive containing the 'part' resources that
- // were created in step 1).
- // Example - FONDEncoderTool {FontFileName} -o {FontArchiveName}
- //
- // NOTE: Be sure that the 'FOND' resource is given the
- // resource type of 'iFND' within the archive, and that
- // it's original rsrc ID is retained. The example line
- // above will copy the 'FOND' resource to the archive,
- // giving it a new resource type of 'iFND' and retaining
- // the original resource ID. The 'FOND' resources should
- // NEVER be compressed when using InstaCompOne compression.
- //
- // EXAMPLE SUMMARY ( case #1 ): This is the simplest case of using InstaCompOne
- // compression for font installation. One font is compressed into a single
- // archive. You may wish to compress many fonts into one InstaCompOne
- // archive. To do this, just be sure and assign each compressed resource
- // the resource type 'part' and a unique ID for each compressed item and to
- // use the FONDEncoderTool for each font contained in the archive.
- // ============================================================================
- //
- // case #2 : Font split, then compressed into seperate archives :
- //
- //
- // 1) Choose a resource item ( not an entire resource type )
- // that you want to split within the source font file.
- // This resource item should not be of type 'FOND'.
- // 2) Split the resource into two or more resources
- // within a temporary file.
- // Example - FileAndRsrcSplitterTool {SplitFontFileName} -k sfnt=17127
- // ( cont. ) -a sfnt=200 -s 30000 -o {SplitFontTempName}
- //
- // NOTE: When splitting the resource item into two or more
- // resource items in a temporary file, be sure to retain
- // the original resource type for the resource items being
- // created in the temporary resource file. This will ensure that
- // when the split resources are compressed the InstaCompOne atom extender
- // will be able to identify the original resource type of the
- // split resources.
- //
- // NOTE: Be sure to specify a unique base ID for the split
- // resource items created within the temporary file. This
- // will ensure that each new resource item can be described
- // when using the InstaCompOne MPW tool to compress the
- // individual split resource pieces.
- //
- // 3) Compress the two resources within the temporary file
- // ( created in step 2) ) into two seperate InstaCompOne archives.
- // Example: InstaCompOneTool {SplitFontTempName} -k sfnt=200 -a part=200 -o {SplitFontArchive1}
- // More: InstaCompOneTool {SplitFontTempName} -k sfnt=201 -a part=201 -o {SplitFontArchive2}
- //
- // NOTE: Be sure to specify a target resource type of 'part'
- // and a unique ID for each compressed resource within the
- // InstaCompOne archive. This will ensure that the InstaCompOne
- // atom extender will be able to find and decompress each font
- // resource successfully. The InstaCompOne atom extender
- // ( decompressor ) expects resources of type 'part'.
- //
- // NOTE: It is not absolutely necessary to compress the two
- // split pieces into two seperate archives, but there seems
- // little use in splitting a resource and then putting both
- // of the split pieces into the same archive.
- //
- // 4) Compress each remaining resources ( except 'FOND' )
- // within the source font file into a 'part'
- // resource item within an InstaCompOne archive.
- // Example:
- // InstaCompOneTool {SplitFontFileName} -k NFNT=17774 -a part=300 -o {SplitFontArchive1}
- //
- // NOTE: It's best to specify 'part' and a unique rsrc ID for each
- // compressed resource archive created within the source file.
- // ( This does not include resources of type 'FOND')
- //
- // 5) Copy ( without compression ) the 'FOND' resource
- // from the source font file into a 'iFND' resource within
- // the same archive containing the 'part' resources that
- // were created in step 1).
- // Example - FONDEncoderTool {FontFileName} -o {FontArchiveName}
- //
- // NOTE: The example line above will copy the 'FOND' resource
- // to the archive, giving the 'FOND' resource a new resource
- // type of 'iFND' and retaining the original resource ID.
- // The 'FOND' resources should NEVER be compressed when using
- // InstaCompOne compression.
- //
- // ============================================================================
- //
- // NOTE: When using InstaCompOne compression, simply enter 241
- // as the value for the atom extender ( 'inex' ) in the next to last field
- // of the atom ( 'infa', 'inff', 'inra' ) for the file/font/rsrc to be
- // decompressed. There is no need to declare an 'inex' resource within the
- // installer script source. An 'inex' resource definition is contained in
- // the InstaCompOne resource file that is included at the top of this file.
- //
- // If not using compression, enter a value of 0 ( zero ) for the
- // atom extender field in the atom ( 'infa', 'inra', 'inff' ).
- //
- //
- //
- // mark young • 08/17/94
- //
- // Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
- //
-
- #include "InstallerTypes.r"
-
- // Include the InstaCompOne atom extender stuff
- // making sure not to add their version resource
- // to our installer script. Also, since this include
- // is a resource include instead of a #include, it is
- // not actually a pre-processor thing, and won't be effected
- // by a -i option within the rez line in the makefile.
- include ":::InstaCompOne 1.0:InstaCompOneAtomExt.rsrc" NOT 'vers';
-
-
- // • packages
-
- // package that demonstrates installation of a font without compression
- resource 'inpk' (400) {
- format0 {
- showsOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "Times font - no compression.",
- {
- 'inff', 4000;
- },
- }
- };
-
- // package that demonstrates compressing a font into an archive
- resource 'inpk' (500) {
- format0 {
- showsOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "Chicago font - compression.",
- {
- 'inff', 5000;
- },
- }
- };
-
- // package that demonstrates splitting and compressing a font into an archive
- resource 'inpk' (600) {
- format0 {
- showsOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "Monaco font - splitting and compression.",
- {
- 'inff', 6000;
- },
- }
- };
-
-
- // • font atoms
-
- // this first font example does not use compression, but is included for reference
-
- // font non-compressed example
- // font => single target file
- resource 'inff' (4000) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- noTgtRequired, // Create new file if necessary
- updateExisting, // Always replace items in target file
- copyIfNewOrUpdate, // Always copy file
- dontIgnoreProtection, // Respect file locking
- srcNeedNotExist, // Create a new file if necessary
-
- byName, // Reference resources by name
- // 'byID' allowed only w/'explicitFamilyMembers'
-
- nameNeedNotMatch, // Ignored when 'byName' is specified
-
- 14001, // TARGET - file spec ( 'intf' )
- 14000, // SOURCE - file spec ( 'infs' )
-
- 0, // TARGET - 'FOND' attributes ( set by scriptcheck )
- 0, // TARGET - Font Family size ( set by scriptcheck )
-
-
- 20, // 'FOND' ID
-
-
- entireFamily{}, // Copy option ( copy entire font and all attributes )
- 0, // Atom extender ID ( none used for this atom )
- "", // Font atom description
- "Times" // FOND family name
- }
- };
-
-
- // font compression example
- // font => archive => single target file
- resource 'inff' (5000) {
- format2 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- encodedFONDRsrc, // • use the FONDEncoder tool to tweak FOND resource
- noTgtRequired, // Create new file if necessary
- updateExisting, // Always replace items in target file
- copyIfNewOrUpdate, // Always copy file
- dontIgnoreProtection, // Respect file locking
- srcNeedExist, // Require a source file
-
- byID, // Reference resources by ID
- // 'byID' allowed only w/'explicitFamilyMembers'
-
- nameNeedNotMatch, // Ignored when 'byName' is specified
-
- 15001, // TARGET - file spec ( 'intf' )
- 15000, // SOURCE - file spec ( 'infs' )
-
- 0, // TARGET - 'FOND' attributes ( set by scriptcheck )
- 0, // TARGET - Font Family size ( set by scriptcheck )
-
- 0, // 'FOND' ID
-
-
- explicitFamilyMembers{ // Copy option ( copy only specified items )
- {
-
- // • 'sfnt' portion
-
- 0, // Target - Point Size
-
- noExtendedStyle, // Target - Style attributes
- noCondensedStyle,
- noShadowStyle,
- noOutlineStyle,
- noUnderlineStyle,
- noItalicStyle,
- noBoldStyle,
-
- 'sfnt', // Target - Resource Type
- resPurgeable, // Target - Resource Attributes
-
- {
- 15000, // Source - Resource File Spec ID
- 'part', // Source - Resource Type
- 128, // Source - Resource ID
- 0, // Resource Size ( filled in by ScriptCheck )
- "Chicago", // Resource Name
- },
-
-
- // • 'NFNT' portion
-
- 12, // Target - Point Size
-
- noExtendedStyle, // Target - Style attributes
- noCondensedStyle,
- noShadowStyle,
- noOutlineStyle,
- noUnderlineStyle,
- noItalicStyle,
- noBoldStyle,
-
- 'NFNT', // Target - Resource Type
- 0, // Target - Resource Attributes
-
- {
- 15000, // Source - Resource File Spec ID
- 'part', // Source - Resource Type
- 129, // Source - Resource ID
- 0, // Resource Size ( filled in by ScriptCheck )
- "", // Resource Name ( 'NFNT's don't use named resource )
- },
-
- }
-
- },
- 241, // Atom extender ID for InstaCompOne
- "", // Font atom description
- "Chicago" // FOND family name
- }
- };
-
-
- // font compression example
- // font => split => archive(s) => single target file
- resource 'inff' (6000) {
- format2 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- encodedFONDRsrc, // • use the FONDEncoder tool to tweak FOND resource
- noTgtRequired, // Create new file if necessary
- updateExisting, // Always replace items in target file
- copyIfNewOrUpdate, // Always copy file
- dontIgnoreProtection, // Respect file locking
- srcNeedExist, // Require a source file
-
- byID, // Reference resources by ID
- // 'byID' allowed only w/'explicitFamilyMembers'
-
- nameNeedNotMatch, // Ignored when 'byName' is specified
-
- 16001, // TARGET - file spec ( 'intf' )
- 16000, // SOURCE - file spec ( 'infs' )
-
- 0, // TARGET - 'FOND' attributes ( set by scriptcheck )
- 0, // TARGET - Font Family size ( set by scriptcheck )
-
- 4, // 'FOND' ID
-
-
- explicitFamilyMembers{ // Copy option ( copy only specified items )
- {
- // • NOTE ON SPLITTING RESOURCES:
- // • you may split as many resources from a source file as you wish,
- // • but the most straight-forward approach to splitting resources
- // • is to place as many entire resources as will fit in one install
- // • disk and to split only those resources that will fill up the
- // • remaining portion of the install disk )
-
- // • 'sfnt' portion will be split ( two source specs, one shared target spec )
-
- 0, // Point Size
-
- noExtendedStyle, // Style attributes
- noCondensedStyle,
- noShadowStyle,
- noOutlineStyle,
- noUnderlineStyle,
- noItalicStyle,
- noBoldStyle,
-
- 'sfnt', // Target - Resource Type
- 0, // Target - Resource Attributes ( set by scriptcheck )
-
- {
- 16000, // Split Resource - Source - file spec ( 'infs' )
- 'part', // Split Resource - Source - Resource Type
- 200, // Split Resource - Source - Resource ID
- 0, // Split Resource - Resource Size ( set by scriptcheck )
- "", // Split Resource - Resource Name
-
-
- 17000, // Split Resource - Source - file spec ( 'infs' )
- 'part', // Split Resource - Source - Resource Type
- 201, // Split Resource - Source - Resource ID
- 0, // Split Resource - Resource Size ( set by scriptcheck )
- "", // Split Resource - Resource Name
- },
-
-
- // • 'NFNT' portion will NOT be split, use standard compression
-
- 9, // Target - Point Size
-
- noExtendedStyle, // Target - Style attributes
- noCondensedStyle,
- noShadowStyle,
- noOutlineStyle,
- noUnderlineStyle,
- noItalicStyle,
- noBoldStyle,
-
- 'NFNT', // Target - Resource Type
- 0, // Target - Resource Attributes ( set by scriptcheck )
-
- {
- 16000, // Source - file spec ( 'infs' )
- 'part', // Source - Resource Type
- 300, // Source - Resource ID
- 0, // Resource Size ( set by scriptcheck )
- "", // Resource Name
- },
-
- // • 'NFNT' portion will NOT be split, use standard compression
-
- 12, // Target - Point Size
-
- noExtendedStyle, // Target - Style attributes
- noCondensedStyle,
- noShadowStyle,
- noOutlineStyle,
- noUnderlineStyle,
- noItalicStyle,
- noBoldStyle,
-
- 'NFNT', // Target - Resource Type
- 0, // Target - Resource Attributes
-
- {
- 16000, // Source - file spec ( 'infs' )
- 'part', // Source - Resource Type
- 301, // Source - Resource ID
- 0, // Source Resource Size ( set by scriptcheck )
- "", // Source Resource Name
- },
-
- }
-
- },
- 241, // Atom extender ID for InstaCompOne
- "", // Font atom description
- "Monaco" // FOND family name
- }
- };
-
-
- // • font specs
-
- // source file spec for font installation w/o compression
- resource 'infs' (14000) {
- 'FFIL', // TYPE
- 'DMOV', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:Times" // PATH to source file
- };
-
- // target file spec for font installation w/o compression
- resource 'intf' (14001) {
- format1 {
- noSearchForFile, // use default search path
- TypeCrMustMatch, // ??
- 'FFIL', // TYPE for file search
- 'DMOV', // CREATOR for file search
- 0, // Finder flags for target ( specify 0 for ScriptCheck to fill in )
- 1, // Creation date for target ( specify 1 for ScriptCheck to fill in )
- 1, // Modification date for target ( specify 1 for ScriptCheck to fill in )
- 0, // 'insp' resource ID ( file search proc )
- "special-font:Times" // path to target file
- }
- };
-
-
- // source file spec for font installation with compression
- resource 'infs' (15000) {
- 'ircp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:fontTome" // PATH to source file
- };
-
- // target file spec for font installation with compression
- resource 'intf' (15001) {
- format1 {
- noSearchForFile, // use default search path
- TypeCrMustMatch, // ??
- 'FFIL', // TYPE for file search
- 'DMOV', // CREATOR for file search
- 0, // Finder flags for target ( specify 0 for ScriptCheck to fill in )
- 1, // Creation date for target ( specify 1 for ScriptCheck to fill in )
- 1, // Modification date for target ( specify 1 for ScriptCheck to fill in )
- 0, // 'insp' resource ID ( file search proc )
- "special-font:Chicago" // path to target file
- }
- };
-
-
-
- // source file spec for font installation with split compression
- resource 'infs' (16000) {
- 'ircp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:splitFontTome1" // PATH to source file
- };
-
- // source file spec for font installation with split compression
- resource 'infs' (17000) {
- 'ircp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 2:splitFontTome2" // PATH to source file
- };
-
- // target file spec for font installation w/split compression
- resource 'intf' (16001) {
- format1 {
- noSearchForFile, // use default search path
- TypeCrMustMatch, // ??
- 'FFIL', // TYPE for file search
- 'DMOV', // CREATOR for file search
- 0, // Finder flags for target ( specify 0 for ScriptCheck to fill in )
- 1, // Creation date for target ( specify 1 for ScriptCheck to fill in )
- 1, // Modification date for target ( specify 1 for ScriptCheck to fill in )
- 0, // 'insp' resource ID ( file search proc )
- "special-font:Monaco" // path to target file
- }
- };
-
-
-